﻿<%@ Page Title="Quản lý danh mục Web" Language="vb" AutoEventWireup="false" MasterPageFile="~/Master/InSite.Master" CodeBehind="MenuManager.aspx.vb" Inherits="Core.MenuManager" MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<fieldset style="width:350px;margin: 0 auto;">
    <table width="100%">
        <tr>
            <td style="width:110px; color: #666666;">
                Tên danh mục:
            </td>
            <td>
                <asp:TextBox ID="txtCatName" class="mediumfield" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width:110px; color: #666666;">
                Danh mục:
            </td>
            <td>
                <asp:DropDownList ID="cbxLevel" runat="server" CssClass="centerCbx" 
                    Width="100px" AutoPostBack="True"></asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td style="width:110px; color: #666666;">
                <asp:Label ID="lbType" runat="server" Text="Loại danh mục: " ForeColor="#666666"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="cbxType" runat="server" CssClass="centerCbx" AutoPostBack="True"></asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td style="width:110px; color: #666666;">
                <asp:Label ID="lbCat" runat="server" Text="Thuộc nhóm: " ForeColor="#666666" Visible="false"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="cbxCat" runat="server" CssClass="centerCbx" Visible="false"></asp:DropDownList>
            </td>
        </tr>
        
        <tr>
            <td style="width:110px; color: #666666;">
                Trạng thái:
            </td>
            <td>
                <asp:DropDownList ID="cbxStatus" runat="server" CssClass="centerCbx" Width="218px"></asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <asp:Button ID="btnNew" runat="server" Text="Thêm mới" class="button" Height="26px" />
                <asp:Button ID="btnPublish" runat="server" Text="Xuất bản" class="button" Height="26px" />
            </td>
        </tr>
    </table>
</fieldset>
<br />

<fieldset style="width:600px;margin: 0 auto;" id="list">
<legend>Chỉnh Sửa | <a href="MenuOrder.aspx#list">Sắp Xếp</a></legend>

    <asp:SqlDataSource ID="dsCat" runat="server"></asp:SqlDataSource>
    <asp:SqlDataSource ID="dsStt" runat="server"></asp:SqlDataSource>
    <asp:SqlDataSource ID="dsSubCat" runat="server"></asp:SqlDataSource>
    <asp:GridView runat="server" ID="gridCat" AutoGenerateColumns="false" DataSourceID="dsCat" class="tblMain" DataKeyNames="CatID" BorderWidth="0" Width="600px" HeaderStyle-BackColor="#9097a9">
        <Columns>
        <asp:TemplateField HeaderText="No.">
            <ItemTemplate>
                <asp:Label Visible="false" runat="server" ID="lbl_ID" Text='<%#Eval("CatID") %>'></asp:Label>
                <asp:Label runat="server" ID="lblSTT" Text='<%#Container.DataItemIndex + 1 %>'></asp:Label>
            </ItemTemplate>
            <HeaderStyle Width="50px" HorizontalAlign="Left" />
            <ItemStyle Width="50px" />
        </asp:TemplateField>
         
        <asp:TemplateField HeaderText="" ShowHeader="False" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="100"> 
                <EditItemTemplate> 
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="True" CommandName="Update" ImageUrl="~/static/inSite/images/save.png" CssClass="noneCSS"/>
                    <asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/static/inSite/images/stop.png" CssClass="noneCSS"/>
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="Edit" ImageUrl="~/static/inSite/images/edit.png" CssClass="noneCSS"/>
                    <asp:ImageButton ID="butDelete" runat="server" CausesValidation="False" CommandName="Delete" ImageUrl="~/static/inSite/images/recycle.png" CssClass="noneCSS" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa <Danh Mục> này? \n\nChú ý: Toàn bộ <Danh Mục Cấp 2> và <Sản Phẩm> thuộc Nhóm này cũng sẽ bị xóa theo.');"/>
                </ItemTemplate> 
                <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                <ItemStyle Width="140px"></ItemStyle>
            </asp:TemplateField> 
             
            <asp:TemplateField HeaderText="Tên danh mục">
                <ItemStyle Width="150px" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="lbl_CatName" Text='<%#Eval("CatPageName") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox runat="server" ID="txtCatName" Text='<%#Eval("CatPageName") %>'></asp:TextBox>
                </EditItemTemplate>
                <HeaderStyle HorizontalAlign="Left" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Trạng thái">
                <ItemTemplate>
                    <asp:Label ID="lbGroupName" runat="server" Text='<%#getColorStt(Eval("CatStt")) %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlStt"
                        DataSourceID="dsStt" DataTextField="CodeDesc"  DataValueField="CodeValue"
                    SelectedValue='<%# Bind("CatStt") %>' runat="server">
                    </asp:DropDownList>
                </EditItemTemplate>
                <HeaderStyle HorizontalAlign="Left" />
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>  
                  </td></tr>  
                    <tr>  
                <td colspan="100%">  
                <div id="div<%# Eval("CatID") %>" class="tblChild">  
                    <asp:GridView ID="gridSubCat" runat="server" Width="100%" 
                    AutoGenerateColumns="false" DataKeyNames="CatID" ShowHeader="false" HeaderStyle-BackColor="#9097a9" BackColor="White"
                    OnRowDataBound="gridSubCat_RowDataBound" 
                    OnRowEditing="gridSubCat_RowEditing" 
                    OnRowCancelingEdit="gridSubCat_RowCancelingEdit" 
                    OnRowUpdating="gridSubCat_RowUpdating"
                    OnRowDeleting="gridSubCat_OnRowDeleting">  
                    <Columns>
                        <asp:TemplateField HeaderText="No." ItemStyle-BackColor="#d8d8d8">
                            <ItemTemplate>
                                <asp:Label Visible="false" runat="server" ID="lbl_subID" Text='<%#Eval("SubCatID") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="90px" HorizontalAlign="Left" />
                            <ItemStyle Width="90px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="" ShowHeader="False" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="100" ItemStyle-BackColor="white"> 
                            <EditItemTemplate> 
                                <asp:ImageButton ID="butSubSave" runat="server" CausesValidation="True" CommandName="Update" ImageUrl="~/static/inSite/images/save.png" CssClass="noneCSS"/>
                                <asp:ImageButton ID="butSubCancel" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/static/inSite/images/stop.png" CssClass="noneCSS"/>
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:ImageButton ID="butSubUpdate" runat="server" CausesValidation="False" CommandName="Edit" ImageUrl="~/static/inSite/images/edit.png" CssClass="noneCSS"/>
                                <asp:ImageButton ID="butSubDelete" runat="server" CausesValidation="False" CommandName="Delete" ImageUrl="~/static/inSite/images/recycle.png" CssClass="noneCSS" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa <Danh Mục> này? \n\nChú ý: Toàn bộ <Sản Phẩm> thuộc Nhóm này cũng sẽ bị xóa theo.');"/>
                            </ItemTemplate> 
                            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                             <ItemStyle Width="140px"></ItemStyle>
                        </asp:TemplateField> 
                        <asp:TemplateField ItemStyle-BackColor="white">
                            <ItemStyle Width="150px" />
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lbl_SubCatName" Text='<%#Eval("SubCatPageName") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox runat="server" ID="txtSubCatName" Text='<%#Eval("SubCatPageName") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField ItemStyle-BackColor="white">
                            <ItemTemplate>
                                <asp:Label ID="lbSubCat" runat="server" Text='<%#getColorStt(Eval("SubCatStt")) %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:DropDownList ID="ddlSubStt" runat="server"></asp:DropDownList>
                                <asp:Label ID="lbSubCatStt" Visible="false" runat="server" Text='<%#Eval("SubCatStt") %>'></asp:Label>
                            </EditItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="" ItemStyle-BackColor="white">
                            <ItemTemplate>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:DropDownList ID="ddlSubCat"
                                    DataSourceID="dsSubCat" DataTextField="CatPageName"  DataValueField="CatID"
                                SelectedValue='<%# Bind("CatID") %>' runat="server">
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        
                    </Columns>
                    
                    </asp:GridView>  
                </div></td></tr>  
                </ItemTemplate>  
            </asp:TemplateField>  
        </Columns>
        

    </asp:GridView>
    </fieldset>

</asp:Content>
